﻿#region Copyright(C) 2018 FI Ltd. All rights reserved.

// ==================================================================================================
// Copyright(C) 2018 FI Ltd. All rights reserved.
//
// SYSTEM NAME	:   FI.Net Application Framework 
// COMPONENT ID :   FI.EntityFramework
// COMPONENT DESC:  
//
// CREATED DATE/BY: 18 Aug 2018 / Tian Mi
//
// REVISION HISTORY:	DATE/BY			SR#/CS/PM#/OTHERS		DESCRIPTION OF CHANGE
// ==================================================================================================

#endregion

using FI.Core.Utilities;
using System;
using System.Data.Common;
using System.Data.Entity;

namespace FI.EntityFramework.Interception
{
    /// <summary>
    /// A helper for all not supported command.
    /// </summary>
    internal class UnknownCommandHelper : IDbCommandHelper
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="UnknownCommandHelper"/> class.
        /// </summary>
        /// <param name="command">The command.</param>
        public UnknownCommandHelper(DbCommand command)
        {
            Guard.ArgumentNotNull(command, "command");

            this.Command = command;
        }

        /// <summary>
        /// Resets the delete command.
        /// </summary>
        /// <param name="dbContext">The context to associate.</param>
        public void ResetDeleteCommand(DbContext dbContext)
        {
            throw new NotImplementedException(this.Command.GetType().FullName);
        }

        /// <summary>
        /// Validates the current command if it's a delete command.
        /// </summary>
        /// <returns>
        /// if set to <c>true</c> the current command is delete command.
        /// </returns>
        public bool ValidateDeleteCommand()
        {
            return false;
        }

        /// <summary>
        /// Gets the <see cref="DbCommand" /> to process.
        /// </summary>
        /// <value>
        /// The <see cref="DbCommand" /> to process.
        /// </value>
        public DbCommand Command
        {
            get;
            private set;
        }
    }
}